package ag;

import ag.data.Retrieval;
import ag.webpage.WebPage;
import ag.webpage.snapshot.SnapShot;
import browser.Chorme;
import org.openqa.selenium.WebDriver;

/**
 * @description:
 * @author: 张德长 dechang.zhang@ucarinc.com
 * @date: 10:37:49 2018/11/28
 * @version:2.0
 */
public class Operation {
    public static void main(String[] args) {
        int windowWidth = 1920;
        int windowHeight = 1080;
        boolean show = false;
        WebDriver driver = Chorme.open(windowWidth, windowHeight, show);
        WebPage.init(driver);
        WebPage.waitPage(5000);
        WebDriver tab = Chorme.changeWindow(1, driver);
        // WebPage.waitPage(30000);
        while (true) {
            try {
                SnapShot snapShot = new SnapShot();
                snapShot.shot(tab);
                Retrieval retrieval = new Retrieval();
                Retrieval.url = "http://localhost:8080/test/setAg?data=";
                retrieval.getRawData(snapShot.webPage);
                retrieval.desksResultDeal();
            } catch (Exception e) {
                tab.quit();
                driver.quit();
                System.out.println("获取数据出错" + e);
                break;
            }
            WebPage.waitPage(1000);
        }
    }


}
